package br.com.fogas.database.entidade;

import java.io.Serializable;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

import br.com.fogas.database.IMetadata;
import br.com.fogas.database.enums.PlanoVisitaStatusEnum;

@DatabaseTable(tableName=IMetadata.IPlanoVisitas.table_name)
public class PlanoVisitas implements IMetadata, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@DatabaseField(generatedId = true, columnName=IPlanoVisitas.id)
	private Integer id;
	
	@ForeignCollectionField(eager = true)
	private ForeignCollection<Medidor> medidores;
	
	@DatabaseField(canBeNull=false, foreign=true, foreignAutoRefresh=true, columnName=IPlanoVisitas.cliente)
	private Cliente cliente;
	
	@DatabaseField(foreign=true, foreignAutoRefresh=true, columnName=IPlanoVisitas.local)
	private Cliente local;
	
	@DatabaseField(dataType = DataType.BOOLEAN, columnName = IPlanoVisitas.cs_Local)
	private boolean cs_Local;
	
	@DatabaseField(dataType = DataType.BOOLEAN, columnName = IPlanoVisitas.cs_Visitar)
	private boolean cs_Visitar;
	
	@DatabaseField(columnName = IPlanoVisitas.status)
	private Integer status;
	
	private PlanoVisitaStatusEnum statusEnum;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public ForeignCollection<Medidor> getMedidores() {
		return medidores;
	}

	public void setMedidores(ForeignCollection<Medidor> medidores) {
		this.medidores = medidores;
	}

	public Cliente getCliente() {
		return cliente;
	}

	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}

	public Cliente getLocal() {
		return local;
	}

	public void setLocal(Cliente local) {
		this.local = local;
	}

	public boolean isCs_Local() {
		return cs_Local;
	}

	public void setCs_Local(boolean cs_Local) {
		this.cs_Local = cs_Local;
	}

	public boolean isCs_Visitar() {
		return cs_Visitar;
	}

	public void setCs_Visitar(boolean cs_Visitar) {
		this.cs_Visitar = cs_Visitar;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public PlanoVisitaStatusEnum getStatusEnum() {
		this.statusEnum = PlanoVisitaStatusEnum.getStatusPorID(getStatus());
		return statusEnum;
	}
	
	public void setStatusEnum(PlanoVisitaStatusEnum statusEnum) {
		this.id = statusEnum.getId();
		this.statusEnum = statusEnum;
	}
}